package com.yunbiao.ybbusstopplate.play_sync.file;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class FileClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost", 9999);
        FileInputStream fileInputStream = new FileInputStream("file_to_send.txt");
        OutputStream outputStream = socket.getOutputStream();
        byte[] buffer = new byte[1024*8];
        int bytesRead;
        while ((bytesRead = fileInputStream.read(buffer)) != -1) {
            outputStream.write(buffer, 0, bytesRead);
        }
        fileInputStream.close();
        outputStream.close();
        socket.close();
    }

}